// import axios from 'axios'
import axiosService from './axiosInterceptor'
// import { isEmpty, isNull } from 'lodash'
// import constants from '../utils/constants'

// const qs = require('qs')
const apiHost = process.env.VUE_APP_SERVER_URL
// const apiHost = window.location.protocol + '//' + window.location.hostname + ':8888'
// const apiHost = 'http://192.168.1.129:8888'

// function getQueryParams(map) {
//   let params = []
//   Object.keys(map)
//     .forEach(eachKey => {
//       if (isNull(map[eachKey]) || map[eachKey] === undefined) return
//       if (typeof map[eachKey] === 'object' && isEmpty(map[eachKey])) return
//       params.push(`${eachKey}=${map[eachKey]}`)
//     })
//   if (params.length) return `?${params.join('&')}`
//   return ''
// }

// function objectAddVersionId(data = {}) {
//   data.versionId = sessionStorage.getItem(constants.VERSION_KEY)
//   return data
// }

// function stringAppendVersionId(data = '') {
//   return data + `/${sessionStorage.getItem(constants.VERSION_KEY)}`
// }

const apiServices = {
  // login(loginData) {
  //   const url = `${apiHost}/auth/login`
  //   return axiosService.axios.post(url, qs.stringify(loginData), {
  //     headers: {
  //       'Content-Type': 'application/x-www-form-urlencoded'
  //     }
  //   })
  // },
  // logout() {
  //   const url = `${apiHost}/auth/logout`
  //   return axiosService.axios.post(url, qs.stringify(loginData), {
  //     headers: {
  //       'Content-Type': 'application/x-www-form-urlencoded'
  //     }
  //   })
  // },
  getProjectInfo(projectId) {
    const url = `${apiHost}/pro/project/${projectId}`
    return axiosService.axios.get(url)
  },
  getQiniuUploadToken() {
    const url = `${apiHost}/file/qnUploadToken`
    return axiosService.axios.get(url)
  }
}

export default apiServices
